package com.frxuexi.park2210.news

import androidx.lifecycle.MutableLiveData
import com.frxuexi.lib_base.mvvm.BaseViewModel
import com.frxuexi.lib_base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class NewsViewModel @Inject constructor(val apiService: ApiService):BaseViewModel() {
    var getNewsSuc = MutableLiveData<String>()

    var addNewsSuc=MutableLiveData<String>()

    fun getNews(map: Map<String,Int>){
        httpRequest({apiService.getNews(mapToBody(map))},getNewsSuc::postValue)
    }

    fun addNews(map: Map<String, Any>){
        httpRequest({apiService.addNews(mapToBody(map))},addNewsSuc::postValue)
    }
}